import {
  Column,
  Entity,
  JoinColumn,
  JoinTable,
  ManyToMany,
  ManyToOne,
  PrimaryGeneratedColumn,
} from 'typeorm';
import { Role } from '../../roles/entities/role.entity';

@Entity()
export class Menu {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ comment: '父节点', nullable: true })
  parent_id: number;

  @Column({ comment: '菜单名', unique: true })
  name: string;

  @Column({ comment: '权限表示' })
  menu_code: string;

  @Column({ comment: '节点类型：0目录 1菜单 3按钮' })
  node_type: number;

  @Column({ comment: '路由' })
  url: string;

  @Column({ comment: '组件名称', nullable: true })
  assembly_name: string;

  @Column({ comment: '组件路径', nullable: true })
  assembly_url: string;

  @Column({ comment: '排序', nullable: true })
  sort: number;

  @Column({ comment: '是否被删除', nullable: true })
  is_deleted: boolean;

  @ManyToMany(() => Role)
  role: Role[];
}
